<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改图层管理')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-layerlist-edit" th:object="${layerList}">
            <input name="layerId" th:field="*{layerId}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label">主图层ID：</label>
                <div class="col-sm-8">
                    <div class="input-group">
                        <input id="treeId" name="parentId" type="hidden" th:field="*{parentId}" />
                        <input class="form-control" type="text" onclick="selectLayerlistTree()" id="treeName" readonly="true" th:field="*{parentName}">
                        <span class="input-group-addon"><i class="fa fa-search"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">图层菜单类型：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('layer_menu_type')}">
                        <input type="radio" th:id="${'listType_' + dict.dictCode}" name="listType" th:value="${dict.dictValue}" th:field="*{listType}" required>
                        <label th:for="${'listType_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">图层名称：</label>
                <div class="col-sm-8">
                    <input name="layerName" th:field="*{layerName}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">图层类型：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('layer_type')}">
                        <input type="radio" th:id="${'layerType_' + dict.dictCode}" name="layerType" th:value="${dict.dictValue}" th:field="*{layerType}">
                        <label th:for="${'layerType_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">显示顺序：</label>
                <div class="col-sm-8">
                    <input name="orderNum" th:field="*{orderNum}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">图层请求地址：</label>
                <div class="col-sm-8">
                    <input name="layerUrl" th:field="*{layerUrl}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">矢量库表：</label>
                <div class="col-sm-8">
                    <input name="layerDb" th:field="*{layerDb}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">菜单图标：</label>
                <div class="col-sm-8">
                    <input id="icon" name="icon" th:field="*{icon}" class="form-control" type="text">
                    <div class="ms-parent" style="width: 100%;">
                        <div class="icon-drop animated flipInX" style="display: none;max-height:200px;overflow-y:auto">
                            <div data-th-include="system/menu/icon"></div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">菜单状态：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('sys_show_hide')}">
                        <input type="radio" th:id="${'visible_' + dict.dictCode}" name="visible" th:value="${dict.dictValue}" th:field="*{visible}">
                        <label th:for="${'visible_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">数据集：</label>
                <div class="col-sm-8">
                    <input name="layerSjj" th:field="*{layerSjj}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">数据源：</label>
                <div class="col-sm-8">
                    <input name="layerSjy" th:field="*{layerSjy}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">X坐标：</label>
                <div class="col-sm-8">
                    <input name="layerX" th:field="*{layerX}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">Y坐标：</label>
                <div class="col-sm-8">
                    <input name="layerY" th:field="*{layerY}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">偏航角：</label>
                <div class="col-sm-8">
                    <input name="layerPhj" th:field="*{layerPhj}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">俯仰角：</label>
                <div class="col-sm-8">
                    <input name="layerFyj" th:field="*{layerFyj}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">翻滚角：</label>
                <div class="col-sm-8">
                    <input name="layerFgj" th:field="*{layerFgj}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">图层名称：</label>
                <div class="col-sm-8">
                    <input name="layerTcmc" th:field="*{layerTcmc}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <textarea name="remark" class="form-control">[[*{remark}]]</textarea>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "local/layerlist";

        $(function() {
            $("input[name='icon']").focus(function() {
                $(".icon-drop").show();
            });
            $("#form-layerlist-edit").click(function(event) {
                var obj = event.srcElement || event.target;
                if (!$(obj).is("input[name='icon']")) {
                    $(".icon-drop").hide();
                }
            });
            $(".icon-drop").find(".ico-list i").on("click", function() {
                $('#icon').val($(this).attr('class'));
            });
        });

        $("#form-layerlist-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-layerlist-edit').serialize());
            }
        }

        /*图层管理-新增-选择父部门树*/
        function selectLayerlistTree() {
            var options = {
                title: '图层管理选择',
                width: "380",
                url: prefix + "/selectLayerlistTree/" + $("#treeId").val(),
                callBack: doSubmit
            };
            $.modal.openOptions(options);
        }

        function doSubmit(index, layero){
            var body = layer.getChildFrame('body', index);
               $("#treeId").val(body.find('#treeId').val());
               $("#treeName").val(body.find('#treeName').val());
               layer.close(index);
        }
    </script>
</body>
</html>